/*
 * author      : 吴中勤 
 * date        : 2018/8/16
 * description : 主流程测试
 */

package com.deepexi.adapter.converter.sap;

import com.deepexi.adapter.BootAppTest;
import com.deepexi.adapter.common.ResourceUtils;
import com.deepexi.adapter.facade.moby.request.MobyEventBody;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;


@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@RunWith(SpringRunner.class)
@SpringBootTest(classes = BootAppTest.class)
@DirtiesContext
// dev=mysql, test=h2, 使用不同的 properties
@ActiveProfiles("dev")
//@ActiveProfiles("test")
public class MobyEventHandler4SapTest_MainFlow {
    private static final Logger logger = LoggerFactory.getLogger(MobyEventHandler4SapTest_MainFlow.class);

    @Autowired
    private MobyEventHandler4Sap mobyEventHandler4Sap;

    // 取消分车
//    @Test
//    public void onVehicleUnlocked() throws Exception {
//        MobyEventBody mobyEventBody = ResourceUtils.loadRes2Object(
//                "mock/moby/flow/step_010.json", MobyEventBody.class);
//        sapConverter.onVehicleUnlocked(mobyEventBody);
//    }

    @Test
    public void step_010_onDepositPaid() throws Exception {
        MobyEventBody mobyEventBody = ResourceUtils.loadRes2Object(
                "mock/moby/flow/step_010.json", MobyEventBody.class);
        mobyEventHandler4Sap.onDepositPaid(mobyEventBody);
    }

    @Test
    public void step_020_onCoolingOffPeriodEnded() throws Exception {
        MobyEventBody mobyEventBody = ResourceUtils.loadRes2Object(
                "mock/moby/flow/step_020.json", MobyEventBody.class);
        mobyEventHandler4Sap.onCoolingOffPeriodEnded(mobyEventBody);
    }

    @Test
    public void step_030_onVehicleLocked() throws Exception {
        MobyEventBody mobyEventBody = ResourceUtils.loadRes2Object(
                "mock/moby/flow/step_030.json", MobyEventBody.class);
        mobyEventHandler4Sap.onVehicleLocked(mobyEventBody);
    }

    @Test
    public void step_040_onConsultChanged() throws Exception {
        MobyEventBody mobyEventBody = ResourceUtils.loadRes2Object(
                "mock/moby/flow/step_040.json", MobyEventBody.class);
        mobyEventHandler4Sap.onConsultChanged(mobyEventBody);
    }

    @Test
    public void step_050_onBoutiqueChanged() throws Exception {
        MobyEventBody mobyEventBody = ResourceUtils.loadRes2Object(
                "mock/moby/flow/step_050.json", MobyEventBody.class);
        mobyEventHandler4Sap.onBoutiqueChanged(mobyEventBody);
    }


    @Test
    public void step_060_onInsuranceConfirmed() throws Exception {
        MobyEventBody mobyEventBody = ResourceUtils.loadRes2Object(
                "mock/moby/flow/step_060.json", MobyEventBody.class);
        mobyEventHandler4Sap.onInsuranceConfirmed(mobyEventBody);
    }

    @Test
    public void step_061_onLoanConfirmed() throws Exception {
        MobyEventBody mobyEventBody = ResourceUtils.loadRes2Object(
                "mock/moby/flow/step_061.json", MobyEventBody.class);
        mobyEventHandler4Sap.onLoanConfirmed(mobyEventBody);
    }


    @Test
    public void step_070_onDownPaymentConfirmed() throws Exception {
        MobyEventBody mobyEventBody = ResourceUtils.loadRes2Object(
                "mock/moby/flow/step_070.json", MobyEventBody.class);
        mobyEventHandler4Sap.onDownPaymentConfirmed(mobyEventBody);
    }

    @Test
    public void step_090_onBilling() throws Exception {
        MobyEventBody mobyEventBody = ResourceUtils.loadRes2Object(
                "mock/moby/flow/step_090.json", MobyEventBody.class);
        mobyEventHandler4Sap.onBilling(mobyEventBody);
    }

    @Test
    public void step_100_onFinalPaymentConfirmed() throws Exception {
        MobyEventBody mobyEventBody = ResourceUtils.loadRes2Object(
                "mock/moby/flow/step_100.json", MobyEventBody.class);
        mobyEventHandler4Sap.onFinalPaymentConfirmed(mobyEventBody);
    }

    @Test
    public void step_110_onBoutiqueStockOut() throws Exception {
        MobyEventBody mobyEventBody = ResourceUtils.loadRes2Object(
                "mock/moby/flow/step_110.json", MobyEventBody.class);
        mobyEventHandler4Sap.onBoutiqueStockOut(mobyEventBody);
    }

    @Test
    public void step_120_onVehicleStockOut() throws Exception {
        MobyEventBody mobyEventBody = ResourceUtils.loadRes2Object(
                "mock/moby/flow/step_120.json", MobyEventBody.class);
        mobyEventHandler4Sap.onVehicleStockOut(mobyEventBody);
    }

}



